#!/bin/bash

echo "正在启动海康威视官网Demo项目..."
echo

echo "检查Node.js环境..."
if ! command -v node &> /dev/null; then
    echo "错误: 未检测到Node.js，请先安装Node.js"
    echo "下载地址: https://nodejs.org/"
    exit 1
fi

echo "检查npm环境..."
if ! command -v npm &> /dev/null; then
    echo "错误: 未检测到npm，请检查Node.js安装"
    exit 1
fi

echo "安装项目依赖..."
npm install

if [ $? -ne 0 ]; then
    echo "错误: 依赖安装失败"
    exit 1
fi

echo
echo "启动开发服务器..."
echo "项目将在浏览器中自动打开"
echo "如果没有自动打开，请手动访问: http://localhost:8080"
echo
echo "按 Ctrl+C 停止服务器"
echo

npm run serve




